﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Server_NhaSach.DataTransferObject;
using Server_NhaSach.DataAccess.LogicLayer;
using System.Data;

namespace Server_NhaSach.BusinessLayer
{
    public class CTDieuChinhKhoBlo
    {
              #region "Khai báo các biến"
        private CTDieuChinhKhoDAO da;
        private CTDieuChinhKhoDTO _ctdieuchinh;
        private string _error;
        #endregion
        #region "Khai báo các thuộc tính"
        public string Error
        {
            get { return _error; }
        }
        public CTDieuChinhKhoDTO CTDieuChinh
        {
            get { return _ctdieuchinh; }
            set { _ctdieuchinh = value; }
        }
        #endregion
        #region "Khai báo các Method"
        public CTDieuChinhKhoBlo()
        {
            da = new CTDieuChinhKhoDAO();
        }
        public bool InsertCTDieuChinhKho(string MaPDCK, string MaMH, int SoLuong, double DonGia, double ThanhTien) 
        {
            _ctdieuchinh = new CTDieuChinhKhoDTO(MaPDCK, MaMH, SoLuong, DonGia, ThanhTien);
             if (!da.InsertCTPDCKho(CTDieuChinh))
            {
                _error = da.Error;
                return false;
            }
            return true;
        }
        public bool UpdateCTDieuChinhKho(string MaPDCK, string MaMH, int SoLuong, double DonGia, double ThanhTien) 
        {
            _ctdieuchinh = new CTDieuChinhKhoDTO(MaPDCK, MaMH, SoLuong, DonGia, ThanhTien);
            if (!da.UpdateCTPDCKho(CTDieuChinh))
            {
                _error = da.Error;
                return false;
            }
            return true;
        }
        public bool DeleteCTDieuChinhKho(string MaPDCK,string MaMH)
        {
            if (!da.DeleteCTPDCKho(MaPDCK,MaMH))
            {
                _error = da.Error;
                return false;
            }
            return true;
        }
        public DataSet LayDS_CTPDCKho()
        {
            DataSet ds = new DataSet();
            ds = da.LayDS_CTPDCKho();
            return ds;
        }
        #endregion    
    }
}